use crate::rediswrapper::pool::REDISPOOL;
use crate::deadpool_redis::{cmd};
//设置值
pub async fn set_key_val(key : &String ,val : &String){
    let mut r = REDISPOOL.get().await.unwrap();
    cmd("SET").arg(&[key.to_owned(), val.to_owned(), "EX".to_owned(),"60".to_owned()]).execute_async(&mut r).await.unwrap();
  
}


//获取值
pub async fn get_key_val(key : &String ) -> Option<String> {
    let mut r = REDISPOOL.get().await.unwrap();
    let v = cmd("GET").arg(&[key.to_owned()]).query_async::<String>(&mut r).await;
    match v{
        Ok(s)=>{ Some(s)}
        Err(_e)=>{None}
    }
}